package configs

import (
	"fmt"
	jsoniter "github.com/json-iterator/go"
	"io/ioutil"
)

var Db = &DbConf{}

func init() {
	b, err := ioutil.ReadFile("./configs/config.json")
	if err != nil {
		fmt.Println(err)
		panic("读取系统配置错误")
	}
	err = jsoniter.Unmarshal(b, Db)
	if err != nil {
		fmt.Println(err)
		panic("转换错误")
	}
}

type DbConf struct {
	Driver string `json:"DbDeriver"`
	Host   string `json:"DbHost"`
	Port   string `json:"DbPort"`
	User   string `json:"DbUser"`
	Pwd    string `json:"DbPwd"`
	DbName string `json:"DbName"`
}
